/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Settings.java
 *
 * Created on 17-ene-2012, 15:40:17
 */
package Vista.configuracion;

import Grabacion.ConcatenateAudioAndVideo;
import Grabacion.RecAudioOnly;
import Grabacion.RecordAudio;
import Grabacion.VideoTest;
import Vista.Calibrar.Calibrar;
import Vista.Calibrar.CalibrateFrame;
import Vista.panel.ColorChooser;
import Vista.panel.FrmPrincipal;
import Vista.panel.PnlDibujo;
import com.enterprisedt.net.ftp.FileTransferClient;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.InputEvent;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
import org.edisoncor.gui.util.WindowsUtil;

/**
 *
 * @author Jhon Jairo
 */
public class Settings extends javax.swing.JFrame {

    public static FrmPrincipal frm = new FrmPrincipal();
    public static int thickness = 5;
    public static ColorChooser cl = new ColorChooser();
    public static NameVideo nm = new NameVideo();
    public static boolean state;
    public boolean isConcatenate;
    public boolean done = false;
    private Robot robot;

    public static boolean isState() {
        return state;
    }

    public static void setState(boolean state) {
        Settings.state = state;
    }

    /**
     * Creates new form Settings
     */
    public Settings() {
        try {
            UIManager.setLookAndFeel(new NimbusLookAndFeel());
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(Settings.class.getName()).log(Level.SEVERE, null, ex);
        }
        //this.setLocationRelativeTo(null);
        initComponents();
        try {
            robot = new Robot();
        } catch (AWTException ex) {
            Logger.getLogger(Settings.class.getName()).log(Level.SEVERE, null, ex);
        }
        //new mouseControlClick().start();
        opacityLabel.setVisible(false);
        opacity.setVisible(false);
        stopLabelV.setVisible(false);
        createJlabel.setVisible(false);
        finalJlabel.setVisible(false);
        eraser.setVisible(false);
        jProgressBarSend.setVisible(false);
        jProgressBarBatery.setValue((int) (CalibrateFrame.bateryLevel * 100));
        jProgressBarBatery.setStringPainted(true);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jProgressBarBatery = new javax.swing.JProgressBar();
        jLabel9 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel10 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        opacity = new javax.swing.JSlider();
        opacityLabel = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        recLabelV = new javax.swing.JLabel();
        stopLabelV = new javax.swing.JLabel();
        createJlabel = new javax.swing.JLabel();
        finalJlabel = new javax.swing.JLabel();
        jProgressBarSend = new javax.swing.JProgressBar();
        jLabel3 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        brush = new javax.swing.JSlider();
        jLabel8 = new javax.swing.JLabel();
        eraser = new javax.swing.JSlider();
        checkBrush = new javax.swing.JCheckBox();
        checkEraser = new javax.swing.JCheckBox();
        ColorChooser = new javax.swing.JLabel();
        newWhiteboard = new javax.swing.JLabel();

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel1.setText("Estado del Wiimote");

        jLabel7.setText("Bateria:");

        jProgressBarBatery.setForeground(new java.awt.Color(51, 255, 0));

        jLabel9.setBackground(new java.awt.Color(153, 153, 153));
        jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Images/2000px Nintendo Wii_logo.png"))); // NOI18N

        jLabel10.setFont(new java.awt.Font("Tahoma", 3, 14)); // NOI18N
        jLabel10.setForeground(new java.awt.Color(153, 153, 153));
        jLabel10.setText("Ventana Principal de configuración");

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 322, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(27, 27, 27)
                        .add(jLabel10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 247, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(111, 111, 111)
                        .add(jLabel9))
                    .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 101, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jLabel7)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jProgressBarBatery, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                .add(5, 5, 5)
                .add(jLabel9)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 88, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel7)
                    .add(jProgressBarBatery, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        opacity.setMinimum(20);
        opacity.setValue(100);
        opacity.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                opacityStateChanged(evt);
            }
        });

        opacityLabel.setFont(new java.awt.Font("Calibri", 3, 18)); // NOI18N
        opacityLabel.setForeground(new java.awt.Color(102, 102, 102));
        opacityLabel.setText("Transparencia: ");

        jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Images/Pizarra.png"))); // NOI18N
        jLabel11.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel11MouseClicked(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jLabel11MousePressed(evt);
            }
        });

        jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Images/quitar.png"))); // NOI18N
        jLabel13.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jLabel13.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jLabel13MousePressed(evt);
            }
        });

        jLabel14.setText("Quitar Pizarra");

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(opacityLabel)
                    .add(opacity, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 131, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel12)
                    .add(jLabel11))
                .add(8, 8, 8)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel13, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                    .add(jPanel2Layout.createSequentialGroup()
                        .add(10, 10, 10)
                        .add(jLabel14)
                        .add(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel2Layout.createSequentialGroup()
                        .add(jLabel13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 75, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel14)
                        .addContainerGap())
                    .add(jPanel2Layout.createSequentialGroup()
                        .add(jLabel11)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(opacityLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(opacity, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 53, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(12, 12, 12)
                        .add(jLabel12)
                        .add(17, 17, 17))))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel4.setFont(new java.awt.Font("Calibri", 3, 18)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(102, 102, 102));
        jLabel4.setText("Multimedia: ");

        jLabel2.setFont(new java.awt.Font("Verdana", 1, 14)); // NOI18N
        jLabel2.setText("Video");

        recLabelV.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Images/rec.png"))); // NOI18N
        recLabelV.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                recLabelVMouseClicked(evt);
            }
        });

        stopLabelV.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Images/stop.png"))); // NOI18N
        stopLabelV.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                stopLabelVMouseClicked(evt);
            }
        });

        createJlabel.setText("Grabando/Creando Video ...");

        finalJlabel.setText("Creado Satisfactoriamente");

        jProgressBarSend.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jProgressBarSendPropertyChange(evt);
            }
        });

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Images/captura.png"))); // NOI18N
        jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel3MouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 114, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jPanel3Layout.createSequentialGroup()
                        .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(jLabel2)
                            .add(recLabelV))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(stopLabelV)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel3)))
                .addContainerGap())
            .add(jPanel3Layout.createSequentialGroup()
                .add(22, 22, 22)
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(finalJlabel)
                    .add(createJlabel))
                .add(0, 0, Short.MAX_VALUE))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jProgressBarSend, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 119, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(37, 37, 37))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(18, 18, 18)
                .add(jLabel2)
                .add(28, 28, 28)
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(recLabelV, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(stopLabelV, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .add(25, 25, 25)
                .add(jProgressBarSend, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(3, 3, 3)
                .add(createJlabel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(finalJlabel)
                .addContainerGap(38, Short.MAX_VALUE))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel5.setFont(new java.awt.Font("Calibri", 3, 18)); // NOI18N
        jLabel5.setForeground(new java.awt.Color(102, 102, 102));
        jLabel5.setText("Herramientas: ");

        jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Images/pintar.png"))); // NOI18N

        brush.setMaximum(25);
        brush.setMinimum(5);
        brush.setValue(17);
        brush.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                brushStateChanged(evt);
            }
        });

        jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Images/eraserd.png"))); // NOI18N

        ColorChooser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Images/colores.png"))); // NOI18N
        ColorChooser.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ColorChooserMouseClicked(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                ColorChooserMousePressed(evt);
            }
        });

        newWhiteboard.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Images/nuevo.png"))); // NOI18N
        newWhiteboard.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                newWhiteboardMouseClicked(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                newWhiteboardMousePressed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel4Layout.createSequentialGroup()
                        .add(95, 95, 95)
                        .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 138, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jPanel4Layout.createSequentialGroup()
                        .add(24, 24, 24)
                        .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(jLabel8)
                            .add(jLabel6))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(eraser, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .add(brush, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .add(jPanel4Layout.createSequentialGroup()
                                .add(10, 10, 10)
                                .add(ColorChooser)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .add(newWhiteboard)
                                .add(36, 36, 36)))))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(checkBrush)
                    .add(checkEraser))
                .add(68, 68, 68))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(jPanel4Layout.createSequentialGroup()
                            .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 28, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(brush, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
                            .addContainerGap()
                            .add(checkBrush)
                            .add(23, 23, 23)))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jLabel6)
                        .add(15, 15, 15)))
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel4Layout.createSequentialGroup()
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(eraser, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .add(jPanel4Layout.createSequentialGroup()
                        .add(22, 22, 22)
                        .add(jLabel8))
                    .add(jPanel4Layout.createSequentialGroup()
                        .add(18, 18, 18)
                        .add(checkEraser)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(ColorChooser)
                    .add(newWhiteboard))
                .add(63, 63, 63))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 328, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(40, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void opacityStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_opacityStateChanged
        WindowsUtil.makeWindowsOpacity(frm, (float) opacity.getValue() / 100);
    }//GEN-LAST:event_opacityStateChanged

    private void brushStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_brushStateChanged
        thickness = brush.getValue();
}//GEN-LAST:event_brushStateChanged

    private void recLabelVMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_recLabelVMouseClicked
        NameVideo.jLabelTitle.setText("Grabar");
        Calibrar.set.setVisible(false);
        nm.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        nm.setVisible(true);
        nm.setResizable(false);
        nm.setLocation(0, 0);
        recLabelV.setVisible(false);
        stopLabelV.setVisible(true);
    }//GEN-LAST:event_recLabelVMouseClicked

    private void stopLabelVMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_stopLabelVMouseClicked
        stopLabelV.setVisible(false);
        Settings.jProgressBarSend.setIndeterminate(true);
        if (!NameVideo.jCheckBoxAudio.isSelected()) {
            recLabelV.setVisible(true);
            stopLabelV.setVisible(false);
            setState(false);
            VideoTest.isRec = false;
            try {
                Thread.sleep(100);
            } catch (InterruptedException ex) {
                Logger.getLogger(Settings.class.getName()).log(Level.SEVERE, null, ex);
            }
            System.out.println("stopaudiovideo");
            RecordAudio.tD.stop();
            RecordAudio.tD.close();
            new ConcatenateAudioAndVideo().concatenate("audio.mp3", "video.mp4", NameVideo.name.toString() + ".mp4");
            createJlabel.setVisible(false);
            if (NameVideo.jCheckRecServer.isSelected()) {
                try {
                    System.setProperty("java.net.preferIPv4Stack", "true");
                    FileTransferClient ftp = new FileTransferClient();
                    ftp.setRemoteHost("192.168.190.122");
                    ftp.setUserName("pizarra");
                    ftp.setPassword("pizarra");
                    ftp.connect();
                    done = true;
                    ftp.uploadFile(NameVideo.name.toString() + ".mp4", "/pizarraweb/Videos/" + NameVideo.name.toString() + ".mp4");
                    done = false;
                    jProgressBarSend.setVisible(false);
                    finalJlabel.setText("Enviado correctamente...");
                    ftp.disconnect();
                    finalJlabel.setVisible(true);
                    System.out.println("video Creado...");
                    File video = new File("video.mp4");
                    File audio = new File("audio.mp3");
                    video.delete();
                    audio.delete();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        } else {
            recLabelV.setVisible(true);
            stopLabelV.setVisible(false);
            RecAudioOnly.tD1.stop();
            RecAudioOnly.tD1.close();
            System.out.println("Parado.");
            if (NameVideo.jCheckRecServer.isSelected()) {
                try {
                    FileTransferClient ftp = new FileTransferClient();
                    ftp.setRemoteHost("192.168.190.122");
                    ftp.setUserName("pizarra");
                    ftp.setPassword("pizarra");
                    ftp.connect();
                    ftp.uploadFile(NameVideo.name.toString() + ".mp3", "/pizarraweb/Audio/" + NameVideo.name.toString() + ".mp3");
                    finalJlabel.setText("Enviado correctamente...");
                    ftp.disconnect();
                    finalJlabel.setVisible(true);
                    System.out.println("audio enviado...");
                    Settings.jProgressBarSend.setVisible(false);
                    File audio = new File(NameVideo.name.toString() + ".mp3");
                    if (!NameVideo.jCheckRecPc.isSelected()) {
                        audio.delete();
                    }

                } catch (Exception e) {
                    finalJlabel.setText("error enviando");
                    finalJlabel.setVisible(true);
                    Settings.jProgressBarSend.setVisible(false);
                    e.printStackTrace();
                }
            }
        }

        finalJlabel.setVisible(true);
        System.out.println("archivo sin enviar Creado...");
        File video = new File("video.mp4");
        File video1 = new File(NameVideo.name.toString() + ".mp4");
        File audio1 = new File(NameVideo.name.toString() + ".mp3");
        File audio = new File("audio.mp3");
        video.delete();
        audio.delete();
        if (!NameVideo.jCheckRecPc.isSelected()) {
            video1.delete();
            if (!NameVideo.jCheckBoxAudio.isSelected()) {
                audio1.delete();
            }
        }
    }//GEN-LAST:event_stopLabelVMouseClicked

    private void ColorChooserMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ColorChooserMouseClicked
//        cl.setLocation(100, 0);
//        cl.setResizable(false);
//        cl.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
//        cl.setVisible(true);
    }//GEN-LAST:event_ColorChooserMouseClicked

    private void newWhiteboardMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_newWhiteboardMouseClicked
//        frm.repaint();
    }//GEN-LAST:event_newWhiteboardMouseClicked

    private void jProgressBarSendPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jProgressBarSendPropertyChange
    }//GEN-LAST:event_jProgressBarSendPropertyChange

    public class mouseControlClick extends Thread {

        public void run() {
            //while(true){
            //robot.mouseRelease(InputEvent.BUTTON1_MASK);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            //}


        }
    }

    private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseClicked
        NameVideo.jLabelTitle.setText("Pantallazo");
        PnlDibujo.screenS = true;
        Settings.nm.setLocation(0, 0);
        Settings.nm.setResizable(false);
        Settings.nm.setVisible(true);
    }//GEN-LAST:event_jLabel3MouseClicked

    private void jLabel11MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel11MouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel11MouseClicked

    private void jLabel11MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel11MousePressed
//        if (frm.isVisible()) {
//            frm.setVisible(false);
//        } else {
        frm.setSize((int) Toolkit.getDefaultToolkit().getScreenSize().getWidth(), (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight() - 47);
        opacityLabel.setVisible(true);
        opacity.setVisible(true);
        checkBrush.setSelected(true);
        frm.setVisible(true);
        Calibrar.set.setVisible(true);
        //  }
    }//GEN-LAST:event_jLabel11MousePressed

    private void jLabel13MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel13MousePressed
        if (frm.isVisible()) {
            frm.setVisible(false);
        }
    }//GEN-LAST:event_jLabel13MousePressed

    private void ColorChooserMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ColorChooserMousePressed
        cl.setLocation(100, 0);
        cl.setResizable(false);
        cl.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        cl.setVisible(true);
    }//GEN-LAST:event_ColorChooserMousePressed

    private void newWhiteboardMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_newWhiteboardMousePressed
        frm.repaint();
    }//GEN-LAST:event_newWhiteboardMousePressed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel ColorChooser;
    private javax.swing.JSlider brush;
    public static javax.swing.JCheckBox checkBrush;
    public static javax.swing.JCheckBox checkEraser;
    public static javax.swing.JLabel createJlabel;
    private javax.swing.JSlider eraser;
    public static javax.swing.JLabel finalJlabel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JProgressBar jProgressBarBatery;
    public static javax.swing.JProgressBar jProgressBarSend;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JLabel newWhiteboard;
    private javax.swing.JSlider opacity;
    private javax.swing.JLabel opacityLabel;
    public static javax.swing.JLabel recLabelV;
    public static javax.swing.JLabel stopLabelV;
    // End of variables declaration//GEN-END:variables
}
